/**
 * <p>
 * 表格配置
 *
 * @Author：Roy
 * @Description：计量设备管理
 * @Date：Create by 2023-11-30 18:51:39
 */
// 隐藏操作按钮的规则配置，字段名：isEdit
// const isHidden = (list, row) => {
//   const { isEdit } = row || {}
//   return list.includes(String(isEdit))
// }

const headerConfig = {
  'meter-device': [
    {
      prop: 'deviceCode',
      name: '设备编码',
      minWidth: 100
    },
    {
      prop: 'deviceName',
      name: '设备名称',
      minWidth: 100
    },
    {
      prop: 'deviceTypeName',
      name: '设备类型',
      minWidth: 50
    },
    {
      prop: 'meterTypeName',
      name: '读表类型',
      minWidth: 50
    },
    {
      prop: 'projectName',
      name: '所属项目',
      minWidth: 110
    },
    {
      prop: 'sceneInfoName',
      name: '所属场景',
      minWidth: 50
    },
    {
      prop: 'readMeterTypeName',
      name: '读表类型',
      minWidth: 50
    },
    {
      prop: 'readMeterTagName',
      name: '读表标识',
      minWidth: 50
    },
    {
      prop: 'energyTypeName',
      name: '能源类型',
      minWidth: 50
    }, {
      prop: 'productTypeName',
      name: '统计产品类型',
      minWidth: 50
    }, {
      prop: 'staticsTypeName',
      name: '统计类型',
      minWidth: 50
    },
    // {
    //   prop: 'purpose',
    //   name: '用途',
    //   minWidth: 110
    // },
    {
      prop: 'deviceStatusName',
      name: '当前状态',
      minWidth: 50
    },
    {
      prop: 'statusName',
      name: '启用状态',
      minWidth: 110,
      componentCell: 'CellSwitch',
      authId: 'ecp-admin:meterDevice:enableOrDisable',
      switchConfig: {
        valueTypeProp: 'code',
        dataProp: 'status',
        activeCode: '1',
        activeName: '启用',
        inactiveCode: '2',
        inactiveName: '禁用',
        switchPath: 'meterDevice.enableOrDisable',
        switchParamsProp: {
          id: 'id',
          dictCode: 'dictCode'
        }
      }
    },
    {
      prop: 'delFlagName',
      name: '删除标识',
      minWidth: 110
    },
    {
      name: '操作',
      width: 200,
      fixed: 'right',
      thStyle: { 'text-align': 'left' },
      operateList: [
        {
          type: 'btnText',
          label: '编辑',
          id: 'meter-device-edit',
          authId: 'ecp-admin:meterDevice:update',
          config: { type: 'text' },
          style: { color: 'rgb(219,139,57)' },
          hidden: (val) => {
            return false // !isHidden(['1'], val)
          }
        },
        {
          type: 'btnText',
          label: '详情',
          id: 'meter-device-detail',
          authId: 'ecp-admin:meterDevice:detail',
          config: { type: 'text' },
          style: { color: 'rgb(219,139,57)' }
        },
        {
          type: 'btnText',
          label: '删除',
          id: 'meter-device-delete',
          authId: 'ecp-admin:meterDevice:deleteById',
          isMore: true,
          config: { type: 'text' },
          style: { color: '#ff0000' },
          hidden: (val) => {
            return val.delFlag === '2'
          }
        }
      ]
    }
  ]
}

export default {}
export { headerConfig }
